package com.foreveross.taskservice.application.impl.channel;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.foreveross.taskservice.application.channel.IGradChannelApplication;
import com.foreveross.taskservice.application.impl.BaseJpaApplicationImpl;
import com.foreveross.taskservice.common.GlobalsConst;
import com.foreveross.taskservice.core.domain.channel.GradChannelEntity;
@Service
@Transactional
public class GradChannelApplicationImpl extends BaseJpaApplicationImpl implements IGradChannelApplication{
	
	public List<GradChannelEntity> getEnableChannel() throws Exception{
		return createCriteriaQuery(GradChannelEntity.class)
				.eq("status", GlobalsConst.DATA_STATUS_NORMAL)
				.asc("id").list();
	}

	@Override
	public List<GradChannelEntity> getAllChannel() throws Exception {
		return createCriteriaQuery(GradChannelEntity.class)
				.asc("id").list();
	}

	@Override
	public GradChannelEntity get(String hbaseKey) throws Exception {
		return (GradChannelEntity) createCriteriaQuery(GradChannelEntity.class).eq("hbaseKey", hbaseKey).list().get(0);
	}

}
